﻿namespace MM.Translator.Model
{
    public class LanguageItem
    {
        public string Code { get; set; }
        public string Name { get; set; }

        public bool Equals(LanguageItem other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Code, Code);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (LanguageItem)) return false;
            return Equals((LanguageItem) obj);
        }

        public override int GetHashCode()
        {
            return (Code != null ? Code.GetHashCode() : 0);
        }
    }
}